home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 February: Tool Chest / Apple Developer CD Series Tool Chest February 1996 (Apple Computer)(1996).iso / Sample Code / AOCE Sample Code / PowerTalk Access Modules / Sample SMSAM / SampleSMSAM Source / SampleSMSAMDETemplate / SimpleALNKAddressTemplate.r < prev    next >
Encoding:
Text File  |  1995-07-28  |  10.0 KB  |  296 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        SimpleALNKAddressTemplate.r
  3.  
  4.     Copyright:    © 1991-1994 by Apple Computer, Inc.
  5.                 All rights reserved.
  6.  
  7.     Part of the AOCE Sample SMSAM Package.  Consult the license
  8.     which came with this software for your specific legal rights.
  9.  
  10. */
  11.  
  12.  
  13.  
  14. #ifndef __TYPES__
  15. #include "Types.r"
  16. #endif
  17.  
  18. #ifndef __OCE.R__
  19. #include "OCE.r"
  20. #endif
  21.  
  22. #ifndef __OCE__
  23. #include "OCE.h"
  24. #endif
  25.  
  26. #ifndef __OCETEMPLATES__
  27. #include "OCETemplates.h"
  28. #endif
  29.  
  30. // properties
  31.  
  32. #define kXtnType            kDETFirstDevProperty
  33. #define kTypeChk            (kDETFirstDevProperty+1)
  34. #define kPrDNodeNumber        (kDETFirstDevProperty+2)
  35. #define kPrDirName            (kDETFirstDevProperty+3)
  36. #define kPrDirDiscA            (kDETFirstDevProperty+4)
  37. #define kPrDirDiscB            (kDETFirstDevProperty+5)
  38. #define kPrPart1            (kDETFirstDevProperty+6)
  39. #define kPrPart2            (kDETFirstDevProperty+7)
  40. #define kPrPart3            (kDETFirstDevProperty+8)
  41. #define kPrNumOfPathParts    (kDETFirstDevProperty+9)
  42. #define kPrCidSource         (kDETFirstDevProperty+10)            /* long 00000000*/ 
  43. #define kPrCidSequence         (kDETFirstDevProperty+11)            /* long 00000000*/ 
  44. #define kPrEntityName         (kDETFirstDevProperty+12) 
  45. #define kPrEnitityType         (kDETFirstDevProperty+13)             /* RSrting " User" */
  46. #define kPrALNKAddress         (kDETFirstDevProperty+14)             // ALNK Address
  47. #define    kPrTheValue2        (kDETFirstDevProperty+15)
  48.  
  49. // ************************************** The templates: ******************************
  50. // Resource ids (note: these ids are packed together more tightly than is normal for templates; this is
  51. //    done in order to fit within the id range allocated to clFindInfoPage):
  52.  
  53. #define    kDETAddrFirstID            (5000)
  54. #define    kDETAddrSecondID        (5000+kDETIDSep)
  55. #define    kDETAddrThirdID            (5000+2*kDETIDSep)
  56.  
  57. #define kALNKAddressInfoPageAspect        kDETAddrFirstID                // pref mail slot aspect
  58. #define kALNKAddressInfoPage            kDETAddrSecondID            // info page header view
  59.  
  60. #define kALNKAddressRecTypeBody kUserRecTypeBody
  61.  
  62. // ************************************** Main Aspect: ******************************
  63. // this is an aspect template
  64. // main aspect tells the DE what kind and what category this template is in the sublist
  65.  
  66. // the kind is address
  67. resource 'rstr' (kALNKAddressInfoPageAspect+kDETAspectKind, purgeable) {
  68.     "Address"
  69. };
  70.  
  71. //resource 'rstr' (kALNKAddressInfoPageAspect+kDETAspectName, purgeable) {
  72. //    "Applelink Address"
  73. //};
  74.  
  75.  
  76. // this will make "New Applelink Address" shows in directory menu  ??? is this in main aspect???
  77. resource 'rstr' (kALNKAddressInfoPageAspect+kDETAspectNewMenuName, purgeable) {
  78.     "New Applelink Address"
  79. };
  80.  
  81.  
  82. /* ************************************** InfoPage Aspect ******************************************** */
  83. // Aspect for ALNK pref mail slot:
  84. // 'deta' this is a aspect template
  85. resource 'deta' (kALNKAddressInfoPageAspect, purgeable) { 0, dropCheckConflicts, isMainAspect };
  86.  
  87. resource 'rstr' (kALNKAddressInfoPageAspect+kDETTemplateName, purgeable) {
  88.     "Applelink Address Info Page Aspect"
  89. };
  90.  
  91. // this template apply to the ÓUser record
  92. resource 'rstr' (kALNKAddressInfoPageAspect+kDETRecordType, purgeable) {
  93.     kALNKAddressRecTypeBody
  94. };
  95.  
  96. // this template apply to the kPrefMailAttrTypeBody attribute
  97. resource 'rstr' (kALNKAddressInfoPageAspect+kDETAttributeType, purgeable) {
  98.     kMailSlotsAttrTypeBody
  99. };
  100.  
  101. resource 'detw' (kALNKAddressInfoPageAspect+kDETAspectInfoPageCustomWindow, "Applelink address Custom Window", purgeable) {
  102.     {-1, -1, kDETAttributeInfoWindHeight, kDETAttributeInfoWindWidth},
  103.     includePopup
  104. };
  105.  
  106. resource 'detn' (kALNKAddressInfoPageAspect+kTypeChk)    { 'ALNK' };
  107. resource 'detn' (kALNKAddressInfoPageAspect+kDETAttributeValueTag)    { 'ALNK' };
  108.  
  109. // dett attribute look up table
  110. // if you want to change this table, do change kDETAspectNewValue to match the new table
  111. resource 'dett' (kALNKAddressInfoPageAspect+kDETAspectLookup, "Applelink Address lookup guide", purgeable)
  112.     {{
  113.         {kMailSlotsAttrTypeBody},
  114.         'ALNK', 
  115.         useForInput,    
  116.         useForOutput, 
  117.         notInSublist,    
  118.         isNotAlias,isNotRecordRef,
  119.         // mailslot attribute
  120.         { 
  121.         
  122.             //                                        unused fields here
  123.         
  124.             /* generic stuff (no changes needed) */
  125.             
  126.             'wsiz',                                 kDETNoProperty,    0;
  127.             '((((',                                    kDETNoProperty,    0;        // kWholeLength
  128.                 'long', kXtnType,                                       0;         /* long  'ALNK'*/
  129.                 'equa', kXtnType, kTypeChk;
  130.                 'enab',                                kDETNoProperty,    0;
  131.                 'wsiz',                                kDETNoProperty,    0;
  132.                 '((((',                                kDETNoProperty,    0;        // kPackedRidLength 
  133.                     'wsiz',                            kDETNoProperty,    0;
  134.                     '((((',                            kDETNoProperty,    0;        // kRLILength 0032
  135.                         'long', kPrDNodeNumber,                        0;
  136.                         'rstr', kPrDirName,                            0;
  137.                         'awrd', kDETNoProperty,                        0;
  138.                         
  139.                         'long', kPrDirDiscA,                        0;
  140.                         'long', kPrDirDiscB,                        0;
  141.                         
  142.                         'wsiz',                     kDETNoProperty,    0;
  143.                         '((((', kDETNoProperty,                        0;        // kPackedPathLength
  144.                             'word', kPrNumOfPathParts,                0;
  145.                         '))))',                        kDETNoProperty,    0;        // kPackedPathLength
  146.                     '))))',                            kDETNoProperty,    0;        // kRLILength
  147.                     
  148.                     'long', kPrCidSource,                             0;        /* long 00000000*/ 
  149.                     'long', kPrCidSequence,                         0;        /* long 00000000*/ 
  150.                     
  151.                     'rstr', kDETAspectName,                         0;         /* RString "<Name>" */
  152.                     'awrd',                         kDETNoProperty,    0;
  153.                     'rstr', kPrEnitityType,                         0;         /* RString " User" */
  154.                     'awrd',                         kDETNoProperty, 0;
  155.                 '))))',                                kDETNoProperty,    0;        // kPackedRidLength
  156.                 
  157.                 /* specific address information */
  158.                 
  159.                 'rstr', kPrALNKAddress,                         0;         /* "<address@host>" */
  160.                 'awrd',                         kDETNoProperty,    0;
  161.                 
  162.             '))))',                                    kDETNoProperty,    0;        // kWholeLength
  163.             'Pref',                                    kDETNoProperty, 0;    //    let address page know to update pref mail slot
  164.         };
  165.     }};
  166.  
  167.  
  168. // this data is in the format desribed in the above 'dett'
  169. // (few changes needed, marked with %%% where need to change)
  170.  
  171. #if 1
  172. data 'detb' (kALNKAddressInfoPageAspect+kDETAspectNewValue, "Default ALNK RLI") {    
  173. //    $"6473 7063"                                                //    %%%    'dspc' tag
  174.     $"414C 4E4B"                                                //    ****** THIS CHANGES TO 'ALNK' FOR A12
  175.     
  176.     $"0042"                                                        //    %%%    length of all data following
  177.     $"414C 4E4B"                                                //    %%%    4 character addr type ('ALNK')
  178.  
  179.     $"0038"                                                        //    %%%    length of packed RID
  180.     
  181.     $"0020"                                                        //    %%%    length of RLI    
  182.     $"0000 0000"                                                //        DNode # (0)
  183.     $"0000 0009 4170 706C 656C 696E 6B00"                        //    %%%    Directory name ("Applelink"), even padded
  184.  
  185.     $"414C 4E4B"                                                //        discriminator A ('ALNK')    
  186.     $"0000 0000"                                                //        discriminator B (0)
  187.     
  188.     $"0004 0000"                                                //        packed pathname size
  189.     
  190.     $"0000 0000"                                                //        CID source
  191.     $"0000 0000"                                                //        CID sequence
  192.     
  193.     $"0000 0000"                                                //    %%%    name RString ("<Name>")
  194.     $"0000 0005 F055 7365 7200"                                    //        type RString (".User")
  195.     
  196.     $"0000 0000"                                                //    %%%    xtn value RString ("<Applelink address>")
  197. };
  198. #endif
  199.  
  200. // ************************************** The info-page: ******************************
  201.  
  202.  
  203. // item location in inforpage template window
  204.  
  205. #define    kNameTop                        kDETSubpageLabelTop
  206. #define kNameBottom                        (kNameTop + kDETAppFontLineHeight+4)
  207. #define kAddressTop                        (kNameBottom+8)
  208. #define kAddressBottom                    (kAddressTop + kDETAppFontLineHeight+4)
  209.  
  210. #define kMy1stColumnLeft    (kDET1stColumnLeft-40)
  211. #define kMy1stColumnRight    (kDET1stColumnRight-40)
  212. #define kMy2ndColumnLeft    (kDET2ndColumnLeft-40)
  213. #define kMy2ndColumnRight    (kDETAttribute2ndColumnRight)
  214.  
  215. // info page (view) template ('deti')
  216. resource 'deti' (kALNKAddressInfoPage, purgeable) {
  217.     1000,
  218.     kDETSublistRect,
  219.     selectFirstText,
  220.     {
  221.     kDETNoProperty, kDETNoProperty, kALNKAddressInfoPage;
  222.     },
  223.     {}
  224.     };
  225.  
  226.  
  227. // this template apply to the ÓUser record
  228. resource 'rstr' (kALNKAddressInfoPage+kDETRecordType, purgeable) {
  229.     kALNKAddressRecTypeBody
  230. };
  231.  
  232. // this is the name of the InfoPage template, don't use same name as your aspect name
  233. resource 'rstr' (kALNKAddressInfoPage+kDETTemplateName, purgeable) {
  234.     "Applelink Address Info Page Aspect, use other name"
  235. };
  236.  
  237. // this template apply to the kMailSlotsAttrTypeBody attribute
  238. resource 'rstr' (kALNKAddressInfoPage+kDETAttributeType, purgeable) {
  239.     kMailSlotsAttrTypeBody
  240. };
  241.  
  242. // this is for build in info page view popup
  243. resource 'rstr' (kALNKAddressInfoPage+kDETInfoPageName, purgeable) {
  244.     "Applelink Address"
  245. };
  246.  
  247. // this is to relate the info page to the right aspect
  248. // this need to be exactly same string as aspect kDETName
  249. resource 'rstr' (kALNKAddressInfoPage+kDETInfoPageMainViewAspect, purgeable) {
  250.     "Applelink Address Info Page Aspect"
  251. };
  252.  
  253.  
  254. resource 'detv' (kALNKAddressInfoPage, "subpageview", purgeable)
  255. {
  256.     {
  257.         kDETSubpageIconRect, kDETNoFlags, kDETAspectMainBitmap,
  258.         Bitmap { kDETLargeIcon };
  259.  
  260.         {kNameTop, kMy1stColumnLeft, kNameBottom, kMy1stColumnRight}, kDETNoFlags, kDETNoProperty,
  261.         StaticTextFromView { kDETApplicationFont, kDETApplicationFontSize, kDETRight, kDETBold,"Name:" };
  262.  
  263.         {kNameTop, kMy2ndColumnLeft, kNameBottom, kMy2ndColumnRight}, kDETNoFlags, kDETAspectName,
  264.         EditText { kDETApplicationFont, kDETApplicationFontSize, kDETLeft, kDETNormal };
  265.  
  266.         {kAddressTop, kMy1stColumnLeft, kAddressBottom, kMy1stColumnRight}, kDETNoFlags, kDETNoProperty,
  267.         StaticTextFromView { kDETApplicationFont, kDETApplicationFontSize, kDETRight, kDETBold,"Address:" };
  268.  
  269.         {kAddressTop, kMy2ndColumnLeft, kAddressBottom, kMy2ndColumnRight}, kDETNoFlags, kPrALNKAddress,
  270.         EditText { kDETApplicationFont, kDETApplicationFontSize, kDETLeft, kDETNormal };
  271.     };
  272. };
  273.  
  274.  
  275. //    Include all of the appropriate icon suite resources
  276. #define ICONID    (kALNKAddressInfoPageAspect+kDETAspectMainBitmap)
  277. include $$SHELL("BLJBovineServer")"BovineServerIcons.rsrc" 'ICN#' (200) as 'ICN#' (ICONID);
  278. include $$SHELL("BLJBovineServer")"BovineServerIcons.rsrc" 'icl8' (200) as 'icl8' (ICONID);
  279. include $$SHELL("BLJBovineServer")"BovineServerIcons.rsrc" 'icl4' (200) as 'icl4' (ICONID);
  280. include $$SHELL("BLJBovineServer")"BovineServerIcons.rsrc" 'ics8' (200) as 'ics8' (ICONID);
  281. include $$SHELL("BLJBovineServer")"BovineServerIcons.rsrc" 'ics4' (200) as 'ics4' (ICONID);
  282. include $$SHELL("BLJBovineServer")"BovineServerIcons.rsrc" 'SICN' (200) as 'SICN' (ICONID);
  283. include $$SHELL("BLJBovineServer")"BovineServerIcons.rsrc" 'ics#' (200) as 'ics#' (ICONID);
  284.  
  285.  
  286. data 'FREF' (128) {
  287.     $"6465 7466 0000 7F"                                  /* detf... */
  288. };
  289.  
  290. resource 'BNDL' (128) {
  291.     'ALNK', 0,
  292.     {    'FREF', { 0, 128 },
  293.         'ICN#',    { 0, ICONID }
  294.     }
  295. };
  296.